<template>
  <div class="goodsList" v-if="$store.state.showGoodsList">
      <div class="goodsList-box" v-for="(item, index) in list" :key="index">
        <div class="goodsList-item" @click="gotoGoodsDetail(item.id)" hover-class="tap-hover">
            <img :src="item.thumbnail">
            <div class="gi-title">
              <span>{{item.productname}}</span>
            </div>
            <div class="gi-value">
              <span class="gi-price">￥{{item.price | priceFilter}}</span>
              <div class="iconfont buy-cart">&#xe635;</div>
            </div>
        </div>
      </div>
  </div>
</template>

<script>
export default {
  data() {
    return {};
  },
  filters: {
    priceFilter(value) {
      let realVal = Number(value).toFixed(2);
      return realVal;
    }
  },
  props: {
    list: {
      type: [Object, Array],
      default: []
    }
  },
  computed: {},
  mounted() {},
  methods: {
    gotoGoodsDetail(id) {
     
    }
  }
};
</script>

<style lang="scss" scoped>
.goodsList {
  padding: 0 15px;
  padding-top: 20px;
  background-color: #f5f5f5;
  .goodsList-box {
    float: left;
    width: 50%;
    margin-bottom: 20px;
    overflow: hidden;
    border-radius: 10px;
  }
  .goodsList-item {
    position: relative;
    height: 500px;
    width: 346px;
    margin: 0 auto;
    background-color: #fff;
    overflow: hidden;
    box-shadow: 0 20px 40px 0 #dcdcdc;
  }
  .goodsList-item > img {
    width: 100%;
    height: 346px;
  }
  .gi-title {
    font-size: 24px;
    color: #333;
    height: 56px;
    line-height: 30px;
    padding: 0 20px;
    margin: 10px auto 5px;
    overflow: hidden;
  }
  .gi-badge {
    padding: 0 20px;
    height: 30px;
  }
  .icon-badge {
    float: left;
    width: 58px;
    height: 26px;
    margin-top: 10px;
    border-radius: 4px;
  }
  .gi-value {
    height: 32px;
    margin-top: 18px;
    padding: 0 20px;
  }
  .gi-price {
    float: left;
    width: 50%;
    font-size: 26px;
    color: #ff3535;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .gi-amount {
    float: right;
    width: 50%;
    margin-top: 2px;
    color: #969696;
    font-size: 24px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    text-align: right;
  }
  .goodsList-recom {
    position: relative;
    padding: 20px 10px 40px;
    overflow: hidden;
  }
  .gr-search {
    width: 90%;
  }
  .gr-search-item {
    float: left;
    width: 140px;
    height: 60px;
    line-height: 60px;
    text-align: center;
    color: #333;
    font-size: 26px;
    border-radius: 10px;
    margin-right: 15px;
    background-color: #fff;
    box-shadow: 6px 8px 6px #d3d3d3;
  }
}
.buy-cart {
  position: absolute;
  right: 20px;
  bottom: 24px;
  font-size: 36px;
}
</style>